package main

import (
	"fmt"
	"log"

	"github.com/gin-gonic/gin"
)
func main() {
	engine := gin.Default()
	engine.POST("/addstudent",func(context *gin.Context) {
		fmt.Println(context.FullPath())
		var student Student 
		err := context.BindJSON(&student)
		if err!=nil {
			log.Fatal(err.Error())
			return
		}

		fmt.Println("姓名",student.Name)
		fmt.Println("年龄",student.Age)
		context.Writer.Write([]byte("添加记录" + student.Name))
	})
	engine.Run()
}
type Student struct{
	Name    string 'form:"name"'
	Sex     string 'form:"sex"'
	Age     int 'from:"age"'
}